import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
    {
      path: '/',
      name: 'Login',
      component: () => import('../views/LoginView.vue'),
    },
    {
      path: '/Main',
      name: 'Main',
      component: () => import('../views/MainView.vue'),
      children: [
        //权限
        {
          path: '/PermissionAdd',
          name: 'PermissionAdd',
          component: () => import('../views/Permission/PermissionAddView.vue'),
        },
        {
          path: '/PermissionShow',
          name: 'PermissionShow',
          component: () => import('../views/Permission/PermissionShowView.vue'),
        },
        {
          path: '/PermissionUpd',
          name: 'PermissionUpd',
          component: () => import('../views/Permission/PermissionUpdView.vue'),
        },

        //用户
        {
          path: '/UserShow',
          name: 'UserShow',
          component: () => import('../views/User/UserShowView.vue'),
        },
        {
          path: '/UserAdd',
          name: 'UserAdd',
          component: () => import('../views/User/UserAddView.vue'),
        },
        {
          path: '/UserUpdate',
          name: 'UserUpdate',
          component: () => import('../views/User/UserUpdateView.vue'),
        },
        //角色
        {
          path: '/RoleShow',
          name: 'RoleShow',
          component: () => import('../views/Roles/RoleShowView.vue'),
        },
        {
          path: '/RoleAdd',
          name: 'RoleAdd',
          component: () => import('../views/Roles/RoleAddView.vue'),
        },
        {
          path: '/RoleUpdate',
          name: 'RoleUpdate',
          component: () => import('../views/Roles/RoleUpdateView.vue'),
        },
      ]
    },
  ],
})

export default router
